/**
 *Copyright(c) HNA SYSTEMS Co., LTD
 *
 *@date 2009-9-28
 * 	
 *Original Author: 陈军(chjun)
 *
 *ChangeLog
 *
 */

package com.myway.dto.seat;

import java.io.Serializable;

/**
 * @author 陈军(chjun)
 * @description
 * 
 * 座位图类
 * 
 * @date 2009-9-28
 */
public class IBESeatMap implements Serializable
{

	/**
	 * TODO usage of field
	 */
	private static final long serialVersionUID = -766518636654365739L;

	private IBEPosition[][] map;

	private String orignal;

	/**
	 * @return the map
	 */
	public IBEPosition[][] getMap()
	{
		return map;
	}

	/**
	 * @param map
	 * the map to set
	 */
	public void setMap(IBEPosition[][] map)
	{
		this.map = map;
	}

	/**
	 * @return the orignal
	 */
	public String getOrignal()
	{
		return orignal;
	}

	/**
	 * @param orignal
	 * the orignal to set
	 */
	public void setOrignal(String orignal)
	{
		this.orignal = orignal;
	}

	/**
	 * 
	 *@param mapRow
	 *@param mapColumn
	 *@return
	 *
	 *@author 陈军(chjun)
	 *@description
	 *
	 * 获取指定二维数组行列的座位

	 *
	 *@date 2009-9-29
	 */
	public IBEPosition getPositionStatus(int mapRow, int mapColumn)
	{
		if ( mapRow >= 0 && mapRow < map.length && mapColumn >= 0 && mapColumn < map[0].length )
		{
			return map[mapRow][mapColumn];
		}	
		else
		{
			return null;
		}			
	}

	/**
	 * 
	 *@param row
	 *@param column
	 *@return
	 *
	 *@author 陈军(chjun)
	 *@description
	 *
	 * 获取座位图中指定位置的座位，colunm 为'A B C ...'
	 *
	 *@date 2009-9-29
	 */
	public IBEPosition getSeatStatus(int row, char column)
	{
		int mapRow = 0;
		for ( int i = 0; i < map.length; i++ )
		{
			if ( map[i][0].getSeatRow() != row )
			{
				continue;	
			}			
			mapRow = i;
			break;
		}

		if ( mapRow > 0 )
		{
			for ( int i = 0; i < map[0].length; i++ )
			{
				if ( map[mapRow][i].getSeatColumn() == column )
				{
					return map[mapRow][i];
				}
			}									
		}
		return null;
	}
}
